package com.example.demo.aop;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @ClassName AopController
 * @Author lys4134
 * @Date 2021/08/20 10:12:09
 * @Description AopController
 * @Version 1.0
 **/
@RestController
@RequestMapping("/aop")
public class AopController {

    private static final Logger logger = LoggerFactory.getLogger(AopController.class);

    @TestAop(param1 = "1", param2 = "2", param3 = "3")
    @GetMapping("/test")
    public String test(String username, Integer age, Double money){
        logger.info("测试");
        return "用户名：" + username + ",年龄：" + String.valueOf(age) + ",存款：" + new BigDecimal(money).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + "";
    }
}
